Statements and Functions > Join

Join

Entity-Related Operation Statement

Syntax samples

JOIN <expression> <entity name> {,<priority>}

JOIN 4 EntA

JOIN Var1 EntA, 1

Description

Joins a specified quantity of a designated entity type to the current entity. The entities joined to the current entity lose their identities and any resources owned by the joining entities are transferred automatically to the base entity. Use JOIN to simulate a component being assembled to a main part, such as when wings are attached to the fuselage of an airplane.

 

Entities to be joined must be routed to the current location with a JOIN rule. The current entity waits until enough entities to fill its request have been routed to the current location with a JOIN rule.

 

The resulting entity retains the attributes and name of the base entity. To transfer attributes from the joining entity to the current entity, in the exit logic for the joining entity, copy the desired attribute to a global variable. Then assign the global variable to the attribute of the base entity after the JOIN statement in the processing logic.

 

All resources owned by the joining entity are transferred to the base entity. To JOIN an entity with a specific attribute value to another entity with the same attribute value, use the LOAD PERM statement .

Valid In

Operation logic only. More than one JOIN statement may be used in the same logic.

Components

<expression>

The number of entities to be joined. A zero value is ignored and a negative value generates an error. This expression is evaluated when each entity first encounters it, but is not re-evaluated as the requested entities are joined.

<entity name>

The entity type to be joined to the base entity. Joining entities must come from a JOIN routing and lose their identity once joined.

<priority>

An entity with a higher priority will have arriving entities joined to it before one with a lower priority. This expression should be a number between 0 and 999. For more information on priorities, see Priorities, at the beginning of this section.

Explicit Entity Actions

JOIN passes cost on to the base entity but not statistical information. MedModel counts joined entities as exits.

Example

A patient’s blood sample is sent to the Lab for analysis which normally takes 30 minutes. In the meantime, the patient is sent to the waiting room to wait for the results. When the analysis is completed the sample uses a MATCH statement to signal that the sample, whose attribute identity (ID) matches that of the patient in the waiting room, is ready to be JOINed with the patient. As soon as the two ID’s match, both the sample results and the patient can continue to execute their respective logic. In this case, the patient uses a JOIN statement to call the results, carried by the lab technician, to the waiting room.

Process Table

Entity...

Location...

Operation (min)...

Sample

Lab

WAIT 30

MATCH ID

Patient

Wait_Rm

MATCH ID

JOIN 1 Results

Routing Table

Blk

Output...

Destination...

Rule...

Move Logic...

1

Results

Wait_Rm

JOIN 1

MOVE WITH Tech THEN FREE

1

Patient

Clinic

FIRST 1

MOVE FOR 5

See Also

LOAD, COMBINE, and GROUP. Also see Attributes and the JOIN or LOAD PERM Statement.


© 2012 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com